<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MediaCrawler Pro - 多平台社交媒体爬虫工具</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Arial, sans-serif;
            background: #f5f7fa;
            color: #333;
            overflow: hidden;
        }

        /* 主容器 */
        .app-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        /* 顶部菜单栏 */
        .menu-bar {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 8px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        .app-title {
            font-size: 18px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .window-controls {
            display: flex;
            gap: 8px;
        }

        .window-btn {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            cursor: pointer;
        }

        .btn-minimize { background: #ffbd2e; }
        .btn-maximize { background: #28ca42; }
        .btn-close { background: #ff5f56; }

        /* 工具栏 */
        .toolbar {
            background: white;
            padding: 12px 20px;
            border-bottom: 1px solid #e0e6ed;
            display: flex;
            gap: 15px;
            align-items: center;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }

        .toolbar-btn {
            padding: 8px 16px;
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .toolbar-btn:hover {
            background: #e9ecef;
            transform: translateY(-1px);
        }

        .toolbar-btn.primary {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .toolbar-btn.primary:hover {
            background: #5a6fd8;
        }

        .toolbar-btn.success {
            background: #28a745;
            color: white;
            border-color: #28a745;
        }

        .toolbar-btn.warning {
            background: #ffc107;
            color: #212529;
            border-color: #ffc107;
        }

        .toolbar-btn.danger {
            background: #dc3545;
            color: white;
            border-color: #dc3545;
        }

        /* 主内容区域 */
        .main-content {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        /* 侧边栏 */
        .sidebar {
            width: 250px;
            background: white;
            border-right: 1px solid #e0e6ed;
            display: flex;
            flex-direction: column;
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid #e0e6ed;
            background: #f8f9fa;
        }

        .sidebar-title {
            font-size: 16px;
            font-weight: 600;
            color: #495057;
        }

        .sidebar-nav {
            flex: 1;
            padding: 10px 0;
        }

        .nav-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            border-left: 3px solid transparent;
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 14px;
        }

        .nav-item:hover {
            background: #f8f9fa;
            border-left-color: #667eea;
        }

        .nav-item.active {
            background: #e3f2fd;
            border-left-color: #667eea;
            color: #667eea;
            font-weight: 500;
        }

        .nav-icon {
            font-size: 16px;
            width: 20px;
            text-align: center;
        }

        /* 工作区域 */
        .workspace {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* 标签页 */
        .tab-bar {
            background: white;
            border-bottom: 1px solid #e0e6ed;
            display: flex;
            padding: 0 20px;
        }

        .tab-item {
            padding: 15px 20px;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.2s;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .tab-item:hover {
            background: #f8f9fa;
        }

        .tab-item.active {
            border-bottom-color: #667eea;
            color: #667eea;
            font-weight: 500;
        }

        /* 标签页内容 */
        .tab-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
        }

        .tab-pane {
            display: none;
        }

        .tab-pane.active {
            display: block;
        }

        /* 状态栏 */
        .status-bar {
            background: #f8f9fa;
            border-top: 1px solid #e0e6ed;
            padding: 8px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            color: #6c757d;
        }

        .status-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #28a745;
        }

        .progress-bar {
            width: 200px;
            height: 6px;
            background: #e9ecef;
            border-radius: 3px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            width: 75%;
            transition: width 0.3s;
        }

        /* 配置页面样式 */
        .config-section {
            background: white;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .section-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 15px;
            color: #495057;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .form-row {
            display: flex;
            gap: 20px;
            margin-bottom: 15px;
            align-items: center;
            flex-wrap: wrap;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .form-label {
            font-size: 14px;
            font-weight: 500;
            color: #495057;
        }

        .form-input {
            padding: 8px 12px;
            border: 1px solid #ced4da;
            border-radius: 4px;
            font-size: 14px;
            min-width: 150px;
        }

        .form-select {
            padding: 8px 12px;
            border: 1px solid #ced4da;
            border-radius: 4px;
            background: white;
            cursor: pointer;
            min-width: 120px;
        }

        .form-textarea {
            padding: 8px 12px;
            border: 1px solid #ced4da;
            border-radius: 4px;
            resize: vertical;
            min-height: 80px;
            font-family: inherit;
        }

        .platform-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .platform-card {
            padding: 15px;
            border: 2px solid #e9ecef;
            border-radius: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .platform-card:hover {
            border-color: #667eea;
            transform: translateY(-2px);
        }

        .platform-card.selected {
            border-color: #667eea;
            background: #e3f2fd;
        }

        .platform-icon {
            font-size: 24px;
            margin-bottom: 8px;
        }

        .platform-name {
            font-size: 14px;
            font-weight: 500;
        }

        /* 监控页面样式 */
        .monitor-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }

        .monitor-card {
            background: white;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .monitor-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .monitor-title {
            font-size: 14px;
            color: #6c757d;
            font-weight: 500;
        }

        .monitor-value {
            font-size: 24px;
            font-weight: 600;
            color: #495057;
        }

        .monitor-change {
            font-size: 12px;
            color: #28a745;
        }

        .progress-section {
            margin-bottom: 20px;
        }

        .progress-info {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 14px;
        }

        .progress-bar-large {
            width: 100%;
            height: 12px;
            background: #e9ecef;
            border-radius: 6px;
            overflow: hidden;
        }

        .progress-fill-large {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            width: 75%;
            transition: width 0.3s;
        }

        /* 数据表格样式 */
        .data-table {
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .table-header {
            background: #f8f9fa;
            padding: 15px 20px;
            border-bottom: 1px solid #e0e6ed;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .table-title {
            font-size: 16px;
            font-weight: 600;
            color: #495057;
        }

        .table-actions {
            display: flex;
            gap: 10px;
        }

        .table-btn {
            padding: 6px 12px;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: background 0.2s;
        }

        .table-btn:hover {
            background: #5a6fd8;
        }

        .table-content {
            max-height: 400px;
            overflow-y: auto;
        }

        .table {
            width: 100%;
            border-collapse: collapse;
        }

        .table th,
        .table td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #e9ecef;
        }

        .table th {
            background: #f8f9fa;
            font-weight: 600;
            color: #495057;
            font-size: 13px;
        }

        .table td {
            font-size: 14px;
        }

        .table tr:hover {
            background: #f8f9fa;
        }

        /* 日志样式 */
        .log-container {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 20px;
            font-family: 'Consolas', 'Monaco', monospace;
            font-size: 13px;
            line-height: 1.5;
            max-height: 500px;
            overflow-y: auto;
        }

        .log-entry {
            margin-bottom: 5px;
            display: flex;
            gap: 10px;
        }

        .log-time {
            color: #569cd6;
            min-width: 80px;
        }

        .log-level {
            min-width: 50px;
            font-weight: bold;
        }

        .log-level.info { color: #4ec9b0; }
        .log-level.warn { color: #dcdcaa; }
        .log-level.error { color: #f44747; }

        .log-message {
            flex: 1;
        }

        /* 统计图表样式 */
        .chart-container {
            background: white;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .chart-placeholder {
            height: 300px;
            background: #f8f9fa;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6c757d;
            font-size: 16px;
        }

        /* 设置页面样式 */
        .settings-grid {
            display: grid;
            grid-template-columns: 200px 1fr;
            gap: 20px;
        }

        .settings-nav {
            background: white;
            border-radius: 8px;
            padding: 10px 0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            height: fit-content;
        }

        .settings-nav-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            border-left: 3px solid transparent;
            font-size: 14px;
        }

        .settings-nav-item:hover {
            background: #f8f9fa;
        }

        .settings-nav-item.active {
            background: #e3f2fd;
            border-left-color: #667eea;
            color: #667eea;
        }

        .settings-content {
            background: white;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 200px;
            }
            
            .form-row {
                flex-direction: column;
                align-items: stretch;
            }
            
            .monitor-grid {
                grid-template-columns: 1fr;
            }
            
            .settings-grid {
                grid-template-columns: 1fr;
            }
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .fade-in {
            animation: fadeIn 0.3s ease-out;
        }

        /* 滚动条样式 */
        ::-webkit-scrollbar {
            width: 6px;
        }

        ::-webkit-scrollbar-track {
            background: #f1f1f1;
        }

        ::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 顶部菜单栏 -->
        <div class="menu-bar">
            <div class="app-title">
                🕷️ MediaCrawler Pro
                <span style="font-size: 12px; opacity: 0.8;">v1.0.0</span>
            </div>
            <div class="window-controls">
                <div class="window-btn btn-minimize"></div>
                <div class="window-btn btn-maximize"></div>
                <div class="window-btn btn-close"></div>
            </div>
        </div>

        <!-- 工具栏 -->
        <div class="toolbar">
            <button class="toolbar-btn primary" onclick="createNewTask()">
                🆕 新建任务
            </button>
            <button class="toolbar-btn success" onclick="startCrawling()">
                ▶️ 开始爬取
            </button>
            <button class="toolbar-btn warning" onclick="pauseCrawling()">
                ⏸️ 暂停
            </button>
            <button class="toolbar-btn danger" onclick="stopCrawling()">
                ⏹️ 停止
            </button>
            <div style="width: 1px; height: 20px; background: #dee2e6; margin: 0 10px;"></div>
            <button class="toolbar-btn" onclick="exportData()">
                📊 导出数据
            </button>
            <button class="toolbar-btn" onclick="openSettings()">
                ⚙️ 设置
            </button>
            <button class="toolbar-btn" onclick="showHelp()">
                ❓ 帮助
            </button>
        </div>

        <!-- 主内容区域 -->
        <div class="main-content">
            <!-- 侧边栏 -->
            <div class="sidebar">
                <div class="sidebar-header">
                    <div class="sidebar-title">功能导航</div>
                </div>
                <div class="sidebar-nav">
                    <div class="nav-item active" onclick="switchTab('config')">
                        <span class="nav-icon">⚙️</span>
                        任务配置
                    </div>
                    <div class="nav-item" onclick="switchTab('monitor')">
                        <span class="nav-icon">📊</span>
                        实时监控
                    </div>
                    <div class="nav-item" onclick="switchTab('data')">
                        <span class="nav-icon">💾</span>
                        数据管理
                    </div>
                    <div class="nav-item" onclick="switchTab('viewer')">
                        <span class="nav-icon">🔍</span>
                        数据查看
                    </div>
                    <div class="nav-item" onclick="switchTab('logs')">
                        <span class="nav-icon">📝</span>
                        系统日志
                    </div>
                    <div class="nav-item" onclick="switchTab('stats')">
                        <span class="nav-icon">📈</span>
                        数据统计
                    </div>
                    <div class="nav-item" onclick="switchTab('settings')">
                        <span class="nav-icon">🔧</span>
                        系统设置
                    </div>
                </div>
            </div>

            <!-- 工作区域 -->
            <div class="workspace">
                <!-- 标签页栏 -->
                <div class="tab-bar">
                    <div class="tab-item active" data-tab="config">
                        ⚙️ 任务配置
                    </div>
                    <div class="tab-item" data-tab="monitor">
                        📊 实时监控
                    </div>
                    <div class="tab-item" data-tab="data">
                        💾 数据管理
                    </div>
                    <div class="tab-item" data-tab="viewer">
                        🔍 数据查看
                    </div>
                    <div class="tab-item" data-tab="logs">
                        📝 系统日志
                    </div>
                    <div class="tab-item" data-tab="stats">
                        📈 数据统计
                    </div>
                    <div class="tab-item" data-tab="settings">
                        🔧 系统设置
                    </div>
                </div>

                <!-- 标签页内容 -->
                <div class="tab-content">
                    <!-- 任务配置页面 -->
                    <div class="tab-pane active" id="config">
                        <div class="config-section">
                            <div class="section-title">
                                🎯 平台选择
                            </div>
                            <div class="platform-grid">
                                <div class="platform-card selected" onclick="selectPlatform(this, 'xhs')">
                                    <div class="platform-icon">🔴</div>
                                    <div class="platform-name">小红书</div>
                                </div>
                                <div class="platform-card" onclick="selectPlatform(this, 'douyin')">
                                    <div class="platform-icon">🎵</div>
                                    <div class="platform-name">抖音</div>
                                </div>
                                <div class="platform-card" onclick="selectPlatform(this, 'kuaishou')">
                                    <div class="platform-icon">⚡</div>
                                    <div class="platform-name">快手</div>
                                </div>
                                <div class="platform-card" onclick="selectPlatform(this, 'bilibili')">
                                    <div class="platform-icon">📺</div>
                                    <div class="platform-name">B站</div>
                                </div>
                                <div class="platform-card" onclick="selectPlatform(this, 'weibo')">
                                    <div class="platform-icon">📱</div>
                                    <div class="platform-name">微博</div>
                                </div>
                                <div class="platform-card" onclick="selectPlatform(this, 'zhihu')">
                                    <div class="platform-icon">🗣️</div>
                                    <div class="platform-name">知乎</div>
                                </div>
                            </div>
                        </div>

                        <div class="config-section">
                            <div class="section-title">
                                🔧 爬取配置
                            </div>
                            <div class="form-row">
                                <div class="form-group">
                                    <label class="form-label">爬取类型</label>
                                    <select class="form-select">
                                        <option>关键词搜索</option>
                                        <option>指定帖子</option>
                                        <option>创作者主页</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">登录方式</label>
                                    <select class="form-select">
                                        <option>二维码登录</option>
                                        <option>手机号登录</option>
                                        <option>Cookie登录</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">数据保存</label>
                                    <select class="form-select">
                                        <option>SQLite数据库</option>
                                        <option>MySQL数据库</option>
                                        <option>JSON文件</option>
                                        <option>CSV文件</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group" style="flex: 1;">
                                    <label class="form-label">搜索关键词</label>
                                    <textarea class="form-textarea" placeholder="请输入搜索关键词，多个关键词用逗号分隔">游戏,pan.quark.cn,资源分享</textarea>
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group">
                                    <label class="form-label">爬取数量</label>
                                    <input type="number" class="form-input" value="200" min="1" max="10000">
                                </div>
                                <div class="form-group">
                                    <label class="form-label">起始页码</label>
                                    <input type="number" class="form-input" value="1" min="1">
                                </div>
                                <div class="form-group">
                                    <label class="form-label">并发数</label>
                                    <input type="number" class="form-input" value="3" min="1" max="10">
                                </div>
                            </div>
                        </div>

                        <div class="config-section">
                            <div class="section-title">
                                📋 高级选项
                            </div>
                            <div class="form-row">
                                <label style="display: flex; align-items: center; gap: 8px;">
                                    <input type="checkbox" checked> 爬取一级评论
                                </label>
                                <label style="display: flex; align-items: center; gap: 8px;">
                                    <input type="checkbox"> 爬取二级评论
                                </label>
                                <label style="display: flex; align-items: center; gap: 8px;">
                                    <input type="checkbox"> 下载媒体文件
                                </label>
                                <label style="display: flex; align-items: center; gap: 8px;">
                                    <input type="checkbox"> 启用IP代理
                                </label>
                            </div>
                        </div>

                        <div style="text-align: center; margin-top: 30px;">
                            <button class="toolbar-btn primary" style="padding: 12px 30px; font-size: 16px;" onclick="startCrawling()">
                                🚀 开始爬取
                            </button>
                            <button class="toolbar-btn" style="padding: 12px 30px; font-size: 16px; margin-left: 15px;" onclick="saveConfig()">
                                💾 保存配置
                            </button>
                        </div>
                    </div>

                    <!-- 实时监控页面 -->
                    <div class="tab-pane" id="monitor">
                        <div class="monitor-grid">
                            <div class="monitor-card">
                                <div class="monitor-header">
                                    <div class="monitor-title">当前任务</div>
                                    <div class="status-indicator">
                                        <div class="status-dot"></div>
                                        运行中
                                    </div>
                                </div>
                                <div class="monitor-value">知乎-游戏资源搜索</div>
                                <div style="font-size: 12px; color: #6c757d; margin-top: 5px;">
                                    开始时间: 2025-08-03 15:30:25
                                </div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-header">
                                    <div class="monitor-title">已爬取</div>
                                </div>
                                <div class="monitor-value">1,234</div>
                                <div class="monitor-change">+89 今日</div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-header">
                                    <div class="monitor-title">成功率</div>
                                </div>
                                <div class="monitor-value">96.5%</div>
                                <div class="monitor-change">+2.3% 较昨日</div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-header">
                                    <div class="monitor-title">爬取速度</div>
                                </div>
                                <div class="monitor-value">15</div>
                                <div style="font-size: 12px; color: #6c757d;">条/分钟</div>
                            </div>
                        </div>

                        <div class="config-section">
                            <div class="section-title">📊 进度详情</div>
                            <div class="progress-section">
                                <div class="progress-info">
                                    <span>总进度: 160/200</span>
                                    <span>80%</span>
                                </div>
                                <div class="progress-bar-large">
                                    <div class="progress-fill-large" style="width: 80%;"></div>
                                </div>
                            </div>
                            <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-top: 20px;">
                                <div style="text-align: center;">
                                    <div style="font-size: 24px; font-weight: 600; color: #28a745;">155</div>
                                    <div style="font-size: 12px; color: #6c757d;">成功</div>
                                </div>
                                <div style="text-align: center;">
                                    <div style="font-size: 24px; font-weight: 600; color: #dc3545;">3</div>
                                    <div style="font-size: 12px; color: #6c757d;">失败</div>
                                </div>
                                <div style="text-align: center;">
                                    <div style="font-size: 24px; font-weight: 600; color: #ffc107;">2</div>
                                    <div style="font-size: 12px; color: #6c757d;">跳过</div>
                                </div>
                                <div style="text-align: center;">
                                    <div style="font-size: 24px; font-weight: 600; color: #667eea;">40</div>
                                    <div style="font-size: 12px; color: #6c757d;">剩余</div>
                                </div>
                            </div>
                        </div>

                        <div style="text-align: center; margin-top: 30px;">
                            <button class="toolbar-btn warning" onclick="pauseCrawling()">⏸️ 暂停任务</button>
                            <button class="toolbar-btn danger" onclick="stopCrawling()" style="margin-left: 15px;">⏹️ 停止任务</button>
                            <button class="toolbar-btn" onclick="retryFailed()" style="margin-left: 15px;">🔄 重试失败</button>
                        </div>
                    </div>

                    <!-- 数据管理页面 -->
                    <div class="tab-pane" id="data">
                        <div class="data-table">
                            <div class="table-header">
                                <div class="table-title">📊 数据概览</div>
                                <div class="table-actions">
                                    <button class="table-btn" onclick="refreshData()">🔄 刷新</button>
                                    <button class="table-btn" onclick="exportData()">📤 导出</button>
                                </div>
                            </div>
                            <div class="table-content">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th>平台</th>
                                            <th>数据类型</th>
                                            <th>总数量</th>
                                            <th>今日新增</th>
                                            <th>最后更新</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>🗣️ 知乎</td>
                                            <td>问题回答</td>
                                            <td>1,234</td>
                                            <td>89</td>
                                            <td>15:42</td>
                                            <td>
                                                <button class="table-btn" style="font-size: 11px;">查看</button>
                                                <button class="table-btn" style="font-size: 11px;">导出</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>🔴 小红书</td>
                                            <td>笔记内容</td>
                                            <td>856</td>
                                            <td>45</td>
                                            <td>14:30</td>
                                            <td>
                                                <button class="table-btn" style="font-size: 11px;">查看</button>
                                                <button class="table-btn" style="font-size: 11px;">导出</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>🎵 抖音</td>
                                            <td>视频信息</td>
                                            <td>678</td>
                                            <td>23</td>
                                            <td>13:15</td>
                                            <td>
                                                <button class="table-btn" style="font-size: 11px;">查看</button>
                                                <button class="table-btn" style="font-size: 11px;">导出</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>📺 B站</td>
                                            <td>视频评论</td>
                                            <td>432</td>
                                            <td>12</td>
                                            <td>12:45</td>
                                            <td>
                                                <button class="table-btn" style="font-size: 11px;">查看</button>
                                                <button class="table-btn" style="font-size: 11px;">导出</button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px;">
                            <div class="config-section">
                                <div class="section-title">📈 数据统计</div>
                                <div style="text-align: center;">
                                    <div style="font-size: 32px; font-weight: 600; color: #667eea;">3,200</div>
                                    <div style="color: #6c757d;">总数据量</div>
                                </div>
                            </div>
                            <div class="config-section">
                                <div class="section-title">🔥 热门内容</div>
                                <div style="text-align: center;">
                                    <div style="font-size: 32px; font-weight: 600; color: #28a745;">156</div>
                                    <div style="color: #6c757d;">高互动内容</div>
                                </div>
                            </div>
                            <div class="config-section">
                                <div class="section-title">💾 存储空间</div>
                                <div style="text-align: center;">
                                    <div style="font-size: 32px; font-weight: 600; color: #ffc107;">2.3GB</div>
                                    <div style="color: #6c757d;">已使用空间</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 数据查看页面 -->
                    <div class="tab-pane" id="viewer">
                        <div style="background: white; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
                            <div style="text-align: center; padding: 40px;">
                                <div style="font-size: 48px; margin-bottom: 20px;">🔍</div>
                                <h3>数据查看器</h3>
                                <p style="color: #6c757d; margin-top: 10px;">
                                    这里将显示详细的数据查看界面，支持多平台数据切换、筛选和分析
                                </p>
                                <button class="toolbar-btn primary" style="margin-top: 20px;" onclick="openDataViewer()">
                                    打开数据查看器
                                </button>
                            </div>
                        </div>
                    </div>

                    <!-- 系统日志页面 -->
                    <div class="tab-pane" id="logs">
                        <div class="config-section">
                            <div class="section-title">📝 系统日志</div>
                            <div style="margin-bottom: 15px; display: flex; gap: 15px; align-items: center;">
                                <select class="form-select">
                                    <option>全部级别</option>
                                    <option>INFO</option>
                                    <option>WARN</option>
                                    <option>ERROR</option>
                                </select>
                                <select class="form-select">
                                    <option>今天</option>
                                    <option>最近3天</option>
                                    <option>最近7天</option>
                                </select>
                                <input type="text" class="form-input" placeholder="搜索日志内容...">
                                <button class="table-btn">🔍 搜索</button>
                                <button class="table-btn">🗑️ 清空</button>
                            </div>
                            <div class="log-container">
                                <div class="log-entry">
                                    <span class="log-time">15:42:36</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">开始爬取知乎数据...</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:42:37</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">浏览器启动成功</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:42:38</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">等待扫码登录...</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:15</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">登录成功，开始搜索</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:20</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">找到 200 条相关内容</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:25</span>
                                    <span class="log-level warn">WARN</span>
                                    <span class="log-message">部分内容需要登录查看</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:30</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">已爬取 50/200 条数据</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:35</span>
                                    <span class="log-level error">ERROR</span>
                                    <span class="log-message">网络超时，正在重试...</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:40</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">重试成功，继续爬取</span>
                                </div>
                                <div class="log-entry">
                                    <span class="log-time">15:43:45</span>
                                    <span class="log-level info">INFO</span>
                                    <span class="log-message">已爬取 100/200 条数据</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 数据统计页面 -->
                    <div class="tab-pane" id="stats">
                        <div class="chart-container">
                            <div class="section-title">📊 平台数据分布</div>
                            <div class="chart-placeholder">
                                📊 饼图：各平台数据占比<br>
                                小红书: 35% | 知乎: 25% | 抖音: 20% | B站: 12% | 微博: 5% | 其他: 3%
                            </div>
                        </div>

                        <div class="chart-container">
                            <div class="section-title">📈 爬取趋势</div>
                            <div class="chart-placeholder">
                                📈 折线图：每日爬取数量趋势<br>
                                显示最近30天的数据爬取趋势
                            </div>
                        </div>

                        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;">
                            <div class="monitor-card">
                                <div class="monitor-title">总任务数</div>
                                <div class="monitor-value">25</div>
                                <div class="monitor-change">+3 本周</div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-title">成功任务</div>
                                <div class="monitor-value">22</div>
                                <div class="monitor-change">88% 成功率</div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-title">失败任务</div>
                                <div class="monitor-value">3</div>
                                <div class="monitor-change">12% 失败率</div>
                            </div>
                            <div class="monitor-card">
                                <div class="monitor-title">爬取总数</div>
                                <div class="monitor-value">5,432</div>
                                <div class="monitor-change">+234 今日</div>
                            </div>
                        </div>
                    </div>

                    <!-- 系统设置页面 -->
                    <div class="tab-pane" id="settings">
                        <div class="settings-grid">
                            <div class="settings-nav">
                                <div class="settings-nav-item active" onclick="switchSettingsTab('basic')">🔧 基础设置</div>
                                <div class="settings-nav-item" onclick="switchSettingsTab('network')">🌐 网络设置</div>
                                <div class="settings-nav-item" onclick="switchSettingsTab('storage')">💾 存储设置</div>
                                <div class="settings-nav-item" onclick="switchSettingsTab('notification')">🔔 通知设置</div>
                                <div class="settings-nav-item" onclick="switchSettingsTab('ui')">🎨 界面设置</div>
                                <div class="settings-nav-item" onclick="switchSettingsTab('security')">🔐 安全设置</div>
                            </div>
                            <div class="settings-content">
                                <div class="section-title">🔧 基础设置</div>
                                <div class="form-row">
                                    <div class="form-group">
                                        <label class="form-label">最大并发数</label>
                                        <input type="number" class="form-input" value="3" min="1" max="10">
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">请求延时 (秒)</label>
                                        <input type="number" class="form-input" value="2" min="0" max="10" step="0.1">
                                    </div>
                                </div>
                                <div class="form-row">
                                    <div class="form-group">
                                        <label class="form-label">超时时间 (秒)</label>
                                        <input type="number" class="form-input" value="30" min="5" max="300">
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">重试次数</label>
                                        <input type="number" class="form-input" value="3" min="0" max="10">
                                    </div>
                                </div>
                                <div class="form-row">
                                    <label style="display: flex; align-items: center; gap: 8px;">
                                        <input type="checkbox"> 启用无头模式
                                    </label>
                                    <label style="display: flex; align-items: center; gap: 8px;">
                                        <input type="checkbox" checked> 保存登录状态
                                    </label>
                                    <label style="display: flex; align-items: center; gap: 8px;">
                                        <input type="checkbox"> 自动重试失败任务
                                    </label>
                                </div>
                                <div style="margin-top: 30px;">
                                    <button class="toolbar-btn primary">💾 保存设置</button>
                                    <button class="toolbar-btn" style="margin-left: 15px;">🔄 重置默认</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 状态栏 -->
        <div class="status-bar">
            <div class="status-left">
                <div class="status-indicator">
                    <div class="status-dot"></div>
                    就绪
                </div>
                <div class="progress-bar">
                    <div class="progress-fill"></div>
                </div>
                <span>75%</span>
                <span>已爬取: 1,234 条</span>
                <span>用时: 05:23</span>
            </div>
            <div>
                <span>内存: 256MB</span>
                <span style="margin-left: 20px;">2025-08-03 15:42:36</span>
            </div>
        </div>
    </div>

    <script>
        // 标签页切换
        function switchTab(tabName) {
            // 更新侧边栏导航
            document.querySelectorAll('.nav-item').forEach(item => {
                item.classList.remove('active');
            });
            event.target.classList.add('active');

            // 更新标签页栏
            document.querySelectorAll('.tab-item').forEach(item => {
                item.classList.remove('active');
            });
            document.querySelector(`[data-tab="${tabName}"]`).classList.add('active');

            // 更新内容区域
            document.querySelectorAll('.tab-pane').forEach(pane => {
                pane.classList.remove('active');
            });
            document.getElementById(tabName).classList.add('active');
            document.getElementById(tabName).classList.add('fade-in');
        }

        // 平台选择
        function selectPlatform(element, platform) {
            document.querySelectorAll('.platform-card').forEach(card => {
                card.classList.remove('selected');
            });
            element.classList.add('selected');
            console.log('选择平台:', platform);
        }

        // 工具栏功能
        function createNewTask() {
            alert('创建新任务');
        }

        function startCrawling() {
            alert('开始爬取');
            updateStatus('运行中', 'success');
        }

        function pauseCrawling() {
            alert('暂停爬取');
            updateStatus('已暂停', 'warning');
        }

        function stopCrawling() {
            alert('停止爬取');
            updateStatus('已停止', 'danger');
        }

        function exportData() {
            alert('导出数据');
        }

        function openSettings() {
            switchTab('settings');
        }

        function showHelp() {
            alert('帮助信息');
        }

        function saveConfig() {
            alert('配置已保存');
        }

        function refreshData() {
            alert('刷新数据');
        }

        function retryFailed() {
            alert('重试失败任务');
        }

        function openDataViewer() {
            window.open('data_viewer_demo.html', '_blank');
        }

        // 设置页面切换
        function switchSettingsTab(tab) {
            document.querySelectorAll('.settings-nav-item').forEach(item => {
                item.classList.remove('active');
            });
            event.target.classList.add('active');
            console.log('切换设置页面:', tab);
        }

        // 更新状态
        function updateStatus(status, type) {
            const statusIndicator = document.querySelector('.status-indicator');
            const statusDot = statusIndicator.querySelector('.status-dot');
            const statusText = statusIndicator.childNodes[2];
            
            statusText.textContent = status;
            
            // 更新状态点颜色
            statusDot.className = 'status-dot';
            if (type === 'success') statusDot.style.background = '#28a745';
            else if (type === 'warning') statusDot.style.background = '#ffc107';
            else if (type === 'danger') statusDot.style.background = '#dc3545';
        }

        // 实时更新时间
        function updateTime() {
            const now = new Date();
            const timeStr = now.toLocaleString('zh-CN');
            document.querySelector('.status-bar > div:last-child > span:last-child').textContent = timeStr;
        }

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            console.log('MediaCrawler Pro 已加载');
            updateTime();
            setInterval(updateTime, 1000);
            
            // 添加标签页点击事件
            document.querySelectorAll('.tab-item').forEach(item => {
                item.addEventListener('click', function() {
                    const tabName = this.getAttribute('data-tab');
                    switchTab(tabName);
                });
            });
        });

        // 模拟进度更新
        let progress = 75;
        setInterval(() => {
            if (progress < 100) {
                progress += Math.random() * 2;
                if (progress > 100) progress = 100;
                
                document.querySelector('.progress-fill').style.width = progress + '%';
                document.querySelector('.progress-fill-large').style.width = progress + '%';
                document.querySelector('.status-bar span:nth-child(3)').textContent = Math.round(progress) + '%';
            }
        }, 2000);
    </script>
</body>
</html>